<!-- 经典布局 -->
<template>
  <el-container class="layout">
    <el-header :style="{ backgroundColor: globalStore.primary }">
      <div class="header-lf">
        <div class="logo flx-center">泰豪科创一卡通平台</div>
        <ToolBarLeft />
      </div>
      <div class="header-ri">
        <ToolBarRight />
      </div>
    </el-header>
    <Menu />
    <el-container class="classic-content">
      <el-aside v-show="menuList && menuList.length > 0">
        <div class="aside-box" :style="{ width: isCollapse ? '65px' : '210px' }">
          <el-scrollbar>
            <el-menu
              :default-active="activeMenu"
              :router="false"
              :collapse="isCollapse"
              :collapse-transition="false"
              :unique-opened="true"
            >
              <SubMenu :menuList="menuList" />
            </el-menu>
          </el-scrollbar>
        </div>
      </el-aside>
      <el-container class="classic-main">
        <Main />
      </el-container>
    </el-container>
  </el-container>
</template>

<script setup lang="ts" name="layoutClassic">
import { computed } from "vue";
import { useRoute } from "vue-router";
import { useGlobalStore } from "@/stores/modules/global";
import Main from "@/layouts/components/Main/index.vue";
import SubMenu from "@/layouts/components/Menu/SubMenu.vue";
import ToolBarLeft from "@/layouts/components/Header/ToolBarLeft.vue";
import ToolBarRight from "@/layouts/components/Header/ToolBarRight.vue";
import Menu from "../components/Menu/Menu.vue";
import { useMenuStore } from "@/stores/modules/menu";
import { getShowMenuList } from "@/utils";

const menuList = computed(() => getShowMenuList(menuStore.subMenuList));
const route = useRoute();
const globalStore = useGlobalStore();
const menuStore = useMenuStore();
const isCollapse = computed(() => globalStore.isCollapse);

const activeMenu = computed(() => (route.meta.activeMenu ? route.meta.activeMenu : route.path) as string);
</script>

<style scoped lang="scss">
@import "./index.scss";
</style>
